//
//  DataBase.h
//  Lesson_UI_MySql
//
//  Created by dllo on 15/7/10.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>   //自定义的类用"",系统类<>
#import "CookModel.h"
#import "KnowledgeModel.h"


#warning 使用数据库，必须添加libsqlite3.0.dylib 静态文件，并且引入sqlite3.h

@interface DataBase : NSObject


+(DataBase *)shareDataBaseHandle;

-(void)openDB;   //开启数据库
-(void)creatTable;  //创建表格


//插入一个菜谱信息
-(void)insertCookInfo:(CookModel *)cook;

//更新菜谱信息
-(void)updateCookInfo:(CookModel *)cook number:(NSInteger)number;

//删除一条菜谱信息
-(void)deleteCookInfo:(NSInteger)number;

//查询一条菜谱信息
-(NSMutableArray *)selectCook;

//关闭数据库
-(void)closeDB;






+(DataBase *)KnowledgeDataBaseHandle;

-(void)openKnowledgeDB;   //开启数据库
-(void)creatKnowledgeTable;  //创建表格


-(void)insertKnowledgeInfo:(KnowledgeModel *)knowledge;
-(void)updateKnowledgeInfo:(KnowledgeModel *)knowledge number:(NSInteger)number;
-(void)deleteKnowledgeInfo:(NSInteger)number;
-(NSMutableArray *)selectKnowledge;

-(void)closeKnowledgeDB;


@end
